package cn.display.pixelworksx7.constant;

import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.IBinder;
import android.os.Vibrator;
import cn.display.pixelworksx7.util.IrisConfigUtil;

import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;

public class GlobalData {
    public static PackageInfo appConfigInfo;

    public static List<String> params;

    public static Vibrator vibrator;
    public static File storageDir;
    public static Map<String, List<String>> irisConfigMap = new HashMap<>();// key 包名 value 参数集合

    public static Map<String, String> touchConfigMap = new HashMap<>();// key 包名 value 参数集合


    public static String lastTopPackageName = "";// 上一次展示在上层的软件

    public static String lastConfigPackageName = ""; // 上次进行配置的软件

    public static Boolean isShowSystemApp = false;
    public static Boolean isExistsIrisConfigBin = new File(IrisConfigUtil.Companion.getIrisConfigBinFilePath()).exists();
    public static Boolean isExistsTouchConfigBin = new File(IrisConfigUtil.Companion.getTouchConfigBinFilePath()).exists();
    public static Map<String, String> touchModeShell = new HashMap<>();
    public static Map<String, String[]> gpuFreqShell = new HashMap<>();

    public static Map<String, String[]> cpuOnLineStateShell = new HashMap<>();
    public static PackageManager packageManager;

    public static Boolean isOpenIrisConfig = true;

    public static String [] disableIrisCommands = new String[] {"/odm/bin/irisConfig 47 1 0",
            "/odm/bin/irisConfig 258 1 0",
            "/odm/bin/irisConfig 267 2 3 0",
            "/odm/bin/irisConfig 273 1 0",
            "/odm/bin/irisConfig 40 1 0",
            "/odm/bin/irisConfig 56 1 0"};

    static {
        touchModeShell.put("120", "touchHidlTest -c wo 0 26 0");
        touchModeShell.put("240", "touchHidlTest -c wo 0 26 3");
        touchModeShell.put("600", "touchHidlTest -c wo 0 26 258");
        gpuFreqShell.put("max", new String[]{"echo 0 >/sys/class/kgsl/kgsl-3d0/min_pwrlevel", "echo 0 >/sys/class/kgsl/kgsl-3d0/max_pwrlevel"});
        gpuFreqShell.put("min", new String[]{"echo 2 >/sys/class/kgsl/kgsl-3d0/min_pwrlevel", "echo 2 >/sys/class/kgsl/kgsl-3d0/max_pwrlevel"});
        cpuOnLineStateShell.put("powersaveEnable", new String[]{"echo 0 > /sys/devices/system/cpu/cpu0/online", "echo 0 > /sys/devices/system/cpu/cpu1/online", "echo 0 > /sys/devices/system/cpu/cpu2/online"});
        cpuOnLineStateShell.put("powersaveDisable", new String[]{"echo 1 > /sys/devices/system/cpu/cpu0/online", "echo 1 > /sys/devices/system/cpu/cpu1/online", "echo 1 > /sys/devices/system/cpu/cpu2/online"});
    }
}
